# coding: utf8
# datetime: 2021-03-29
# 题目地址: https://leetcode-cn.com/problems/reverse-bits/solution/li-kou-jia-jia-duo-chong-yu-fa-duo-chong-jqw3/


class Solution:
    def reverseBits(self, n: int) -> int:
        rest = 0
        for i in range(32):
            rest = (rest<<1)+(n&1)
            n >>= 1
        return rest


a = Solution()
print(a.reverseBits(123234))
